﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mail;
namespace OnlineTestCOMMON
{
    /// <summary>
    /// 邮件发送 entity类
    /// </summary>
    public class SendMail
    {
        public SendMail()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="name">密码找回用户</param>
        /// <param name="pass">找回的数据库中的密码</param>
        /// <param name="email">email地址</param>
        /// <returns></returns>
        public bool sendMail(string name,string pass,string email)
        {
            try 
            {
                string Email = email;
                string body = "您好！欢迎您来到九色鹊桥婚恋服务网，您注册为：‘"+name+"'密码为：'"+pass+"'";
                string subject = "九色鹊桥温馨提示！！";
                MailMessage myEmail = new MailMessage();
                myEmail.From = "hanyi7399@163.com";/////////////////////////添加客服邮箱
                myEmail.To = email;
                myEmail.Subject = subject;
                myEmail.Body = body;
                myEmail.BodyFormat = MailFormat.Text;
                SmtpMail.SmtpServer = "九色鹊桥婚恋服务网";
                SmtpMail.Send(myEmail);
                return true;
            }
            catch(Exception ex)
            {
                return false;                
            }
        }
    }
}
